<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.scalar.chiptrack.commons.Constants,
                 com.scalar.chiptrack.utils.ConfigManager"%>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/externalUserSetup.do"/>

<html:html locale="true">

<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>

<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js">
</script>
<SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js">
</script>
<SCRIPT language="JavaScript">

function modifyExternalUser()
{
    var pa=document.getElementById("errors");
    pa.innerHTML="";
    var passwd = document.ExternalUserSetupForm[ 'externalUser.password' ].value;
	var rePasswd = document.ExternalUserSetupForm.reEnterPassword.value;
    var vendorid = document.ExternalUserSetupForm[ 'externalUser.vendorId' ].value;
    var customerId = document.ExternalUserSetupForm[ 'externalUser.customerId' ].value;
    var salesPersonId = document.ExternalUserSetupForm[ 'externalUser.salesPersonId' ].value;
    var valid = true;

    if(vendorid == -1 && document.ExternalUserSetupForm[ 'externalUser.userType' ].value == <%=Constants.USER_TYPE_VENDOR%> )
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.vendorId' ].focus();
		pa.innerHTML = pa.innerHTML+"<li> Select Vendor ";
	}

    if(customerId == -1 && document.ExternalUserSetupForm[ 'externalUser.userType' ].value == <%=Constants.USER_TYPE_CUSTOMER%> )
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.customerId' ].focus();
		pa.innerHTML = pa.innerHTML+"<li> Select Customer ";
	}

    if( salesPersonId == -1 && document.ExternalUserSetupForm[ 'externalUser.userType' ].value == <%=Constants.USER_TYPE_SALES_PERSON%> )
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.salesPersonId' ].focus();
		pa.innerHTML = pa.innerHTML+"<li> Select Sales Person ";
	}

    if( passwd != rePasswd )
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.password' ].focus();
		pa.innerHTML = pa.innerHTML+"<li> Password and Confirm Password must be same";
	}
    else
    {
        if(valid){
            valid = validateFormElements();
        }

    }
    if(valid)
	{
        document.ExternalUserSetupForm.action.value="update";
        if ( document.ExternalUserSetupForm[ 'externalUser.userType' ].value == <%=Constants.USER_TYPE_CUSTOMER%> )
        {
            document.ExternalUserSetupForm[ 'externalUser.vendorId' ].selectedIndex = 0;
            document.ExternalUserSetupForm[ 'externalUser.salesPersonId' ].selectedIndex = 0;
        }
        else if ( document.ExternalUserSetupForm[ 'externalUser.userType' ].value == <%=Constants.USER_TYPE_VENDOR%> )
        {
            document.ExternalUserSetupForm[ 'externalUser.customerId' ].selectedIndex = 0;
            document.ExternalUserSetupForm[ 'externalUser.salesPersonId' ].selectedIndex = 0;
        }
        else if ( document.ExternalUserSetupForm[ 'externalUser.userType' ].value == <%=Constants.USER_TYPE_SALES_PERSON%> )
        {
            document.ExternalUserSetupForm[ 'externalUser.customerId' ].selectedIndex = 0;
            document.ExternalUserSetupForm[ 'externalUser.vendorId' ].selectedIndex = 0;
        }
        document.ExternalUserSetupForm.submit();
    }
}

function loadUserData ()
{
    if ( document.ExternalUserSetupForm['externalUser.sameAsUserId'].value != -1 )
    {
        document.ExternalUserSetupForm.sameAsUserId.value=document.ExternalUserSetupForm['externalUser.sameAsUserId'].value;
        document.ExternalUserSetupForm.action.value="sameAsUser";
        document.ExternalUserSetupForm.submit();
    }
	//if close
}


function saveExternalUser()
{
    var pa=document.getElementById("errors");
	var valid = true;

	var extuserid = document.ExternalUserSetupForm[ 'externalUser.userId' ].value;
    var passwd = document.ExternalUserSetupForm[ 'externalUser.password' ].value;
	var rePasswd = document.ExternalUserSetupForm.reEnterPassword.value;
    var vendorid = document.ExternalUserSetupForm[ 'externalUser.vendorId' ].value;
    var customerId = document.ExternalUserSetupForm[ 'externalUser.customerId' ].value;
    var salesPersonId = document.ExternalUserSetupForm[ 'externalUser.salesPersonId' ].value;

    pa.innerHTML="";


    if(extuserid.trim().length == 0)
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.userId' ].focus();
		pa.innerHTML = "<li> Enter External User Id ";
	}
	else if(!AlphaNumHyphen(extuserid,document.ExternalUserSetupForm[ 'externalUser.userId' ],"Y"))
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.userId' ].focus();
		pa.innerHTML = pa.innerHTML+"<li>External User Id should start with alphabets and may contain integers, - , _ only";
	}

    if(vendorid == -1 && document.ExternalUserSetupForm[ 'externalUser.userType' ].value == <%=Constants.USER_TYPE_VENDOR%> )
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.vendorId' ].focus();
		pa.innerHTML = pa.innerHTML+"<li> Select Vendor ";
	}

    if(customerId == -1 && document.ExternalUserSetupForm[ 'externalUser.userType' ].value == <%=Constants.USER_TYPE_CUSTOMER%> )
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.customerId' ].focus();
		pa.innerHTML = pa.innerHTML+"<li> Select Customer ";
	}

    if( salesPersonId == -1 && document.ExternalUserSetupForm[ 'externalUser.userType' ].value == <%=Constants.USER_TYPE_SALES_PERSON%> )
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.salesPersonId' ].focus();
		pa.innerHTML = pa.innerHTML+"<li> Select Sales Person ";
	}

    if(passwd.trim().length==0)
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.password' ].focus();
		pa.innerHTML = pa.innerHTML+"<li> Enter Password";
	}
	else if(rePasswd.trim().length==0)
	{
		valid = false;
        document.ExternalUserSetupForm.reEnterPassword.focus();
		pa.innerHTML = pa.innerHTML+"<li> Enter Confirm Password";
	}
	else if( passwd != rePasswd )
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.password' ].focus();
		pa.innerHTML = pa.innerHTML+"<li> Password and Confirm Password must be same";
	}
    else
    {
        if(valid){
            valid = validateFormElements();
        }
    }

    if(valid)
	{
        document.ExternalUserSetupForm.action.value="save";
        if ( document.ExternalUserSetupForm[ 'externalUser.userType' ].value == <%=Constants.USER_TYPE_CUSTOMER%> )
        {
            document.ExternalUserSetupForm[ 'externalUser.vendorId' ].selectedIndex = 0;
        }
        else if ( document.ExternalUserSetupForm[ 'externalUser.userType' ].value == <%=Constants.USER_TYPE_VENDOR%> )
        {
            document.ExternalUserSetupForm[ 'externalUser.customerId' ].selectedIndex = 0;
            document.ExternalUserSetupForm[ 'externalUser.salesPersonId' ].selectedIndex = 0;
        }
        else if ( document.ExternalUserSetupForm[ 'externalUser.userType' ].value == <%=Constants.USER_TYPE_SALES_PERSON%> )
        {
            document.ExternalUserSetupForm[ 'externalUser.customerId' ].selectedIndex = 0;
            document.ExternalUserSetupForm[ 'externalUser.vendorId' ].selectedIndex = 0;
        }
        document.ExternalUserSetupForm.submit();
    }
}

function validateFormElements()
{
    var pa=document.getElementById("errors");
    var valid = true;
    var firstname = document.ExternalUserSetupForm[ 'externalUser.firstName' ].value;
	var lastname = document.ExternalUserSetupForm[ 'externalUser.lastName' ].value;
	var mail =  document.ExternalUserSetupForm[ 'externalUser.email' ].value;
	var phone = document.ExternalUserSetupForm[ 'externalUser.phoneNumber' ].value;
	var fax = document.ExternalUserSetupForm[ 'externalUser.faxNumber' ].value;

    pa.innerHTML="";

    if(firstname.trim().length == 0)
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.firstName' ].focus();
		pa.innerHTML = pa.innerHTML+"<li> First Name Required";
	}
	else if(!AlphaNum(firstname,document.ExternalUserSetupForm[ 'externalUser.firstName' ],"Y"))
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.firstName' ].focus();
		pa.innerHTML = pa.innerHTML+"<li> First name should have  alphabets or integers only";
	}

    if(!AlphaNum(firstname,document.ExternalUserSetupForm[ 'externalUser.lastName' ],"N"))
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.lastName' ].focus();
		pa.innerHTML = pa.innerHTML+"<li> Last name should have  alphabets or integers only";
	}

    if(mail.trim().length = 0)
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.email' ].focus();
		pa.innerHTML = pa.innerHTML+"<li> Enter Email Id";
	}
	else if(!isValidMailID(mail,document.ExternalUserSetupForm[ 'externalUser.email' ],"Y"))
	{
		valid = false;
		document.ExternalUserSetupForm[ 'externalUser.email' ].focus();
		pa.innerHTML = pa.innerHTML+"<li> Enter a valid Email id";
	}
    if( chkDate(document.ExternalUserSetupForm[ 'externalUser.expiresOn' ].value,"Expires On","N") == false )
	{
		valid = false;
        document.ExternalUserSetupForm[ 'externalUser.expiresOn' ].focus();
		pa.innerHTML = pa.innerHTML+"<li> Expires On Date must be correct";
	}
    return valid
}

var dateElement = "";
function openCalendar(dateValue)
{
    dateElement = dateValue;

    newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
    newWindow.moveTo(550,180);
    newWindow.focus();
}

function assignDate(passedValue)
{
    dateElement.value=passedValue;
    window.focus();
}
function showHideVendor()
{
    userTypeCtrl = document.ExternalUserSetupForm[ 'externalUser.userType' ];
    vendorTR1 = document.getElementById ( "vendorTR" );
    customerTR1 = document.getElementById ( "customerTR" );
    sPersonTR1 = document.getElementById ( "spersonTR" );
    if ( userTypeCtrl.value == <%=Constants.USER_TYPE_CUSTOMER%> )
    {
        customerTR1.style.display = 'block';
        vendorTR1.style.display = 'none';
        sPersonTR1.style.display = 'none';
    }
    else if ( userTypeCtrl.value == <%=Constants.USER_TYPE_VENDOR%> )
    {
        customerTR1.style.display = 'none';
        vendorTR1.style.display = 'block';
        sPersonTR1.style.display = 'none';
    }
    else if ( userTypeCtrl.value == <%=Constants.USER_TYPE_SALES_PERSON%> )
    {
        customerTR1.style.display = 'none';
        vendorTR1.style.display = 'none';
        sPersonTR1.style.display = 'block';
    }
}
</script>
</HEAD>

<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0" onload="showHideVendor()">
<html:form type="com.scalar.chiptrack.externaluser.forms.ExternalUserSetupForm" action="/externalUserSetup.do">
<nested:nest property="externalUser">
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<input type="hidden" name="action">
<input type="hidden" name="sameAsUserId">

<TABLE cellSpacing=0 cellPadding=0 width="100%" border="0">
    <TBODY>
    <TR>
        <td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
            <!-- Side Navigation start -->
            <%@ include file="/jsp/admin/admin_menu.jsp" %>
            <!-- end of the side navigations -->
        </td>
        <TD bgcolor="#ffffff"><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
        <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
        <TD valign="top" width="100%">
            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
            <BR>
            <center><span class="NArialW">External User</span></center>
            <img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
            <table border="0" width="90%" align="right">
                <tr><td colspan='5'><a  name="#e1"></a>&nbsp;</td></tr>
                <tr><td colspan='5'><chiptrack:info styleClass="NArialL" />&nbsp;</td></tr>
                <tr><td colspan='5'><chiptrack:errors styleClass="NArialL" />&nbsp;</td></tr>
                <tr><td colspan='5' class='NArialL'><font styleClass="NArialL" id='errors' color="FF0000" /></td></tr>
                <tr><td colspan='5' align="left" class='NArialL'><font styleClass="NArialL" id="ErrorMessage" color="red"  />&nbsp;</font></td></tr>

                <logic:notEqual name="ExternalUserSetupForm"  property="userAction" value="view">
                    <logic:notEqual name="ExternalUserSetupForm"  property="userAction" value="modify">
                <tr >
                    <td width="10%"><font class="NArialL"><font color='#993333'>Create the new External User same as:&nbsp;&nbsp;:<br> or New External User</font></td>
                    <td colspan="3">

                                <nested:select property="sameAsUserId"  styleClass='txfield'   onchange="loadUserData()">
                                <option value="-1">-- Select User --</option>
                                <html:options collection="usersList" property="value" labelProperty="label" />
                                </nested:select>
                </td>
                </tr>
                    </logic:notEqual>
                </logic:notEqual>

                <tr>
                    <td width="10%"><font class="NArialL">External User Id:</font><font color="RED" size="1"><B> *</B></font></td>
                    <td>
                        <logic:equal name="ExternalUserSetupForm"  property="userAction" value="view">
                            <nested:text property="userId" size="25" maxlength='25' styleClass='txfield' disabled="true"/>
                        </logic:equal>
                        <logic:notEqual name="ExternalUserSetupForm" property="userAction" value="view">
                            <logic:equal name="ExternalUserSetupForm"  property="userAction" value="modify">
                                <nested:text property="userId" size="25" maxlength='25' styleClass='txfield' disabled="true"/>
                                <nested:hidden property="userId"/>
                            </logic:equal>
                            <logic:notEqual name="ExternalUserSetupForm"  property="userAction" value="modify">
                                <nested:text property="userId" size="25" maxlength='25' styleClass='txfield'/>
                            </logic:notEqual>
                        </logic:notEqual>
                    </td>

                    <td width="10%"><font class="NArialL">User Type:</font><font color="RED" size="1"><B> *</B></font></td>
                    <td width="20%">
                        <%
                            String userTypeCustomer = Constants.USER_TYPE_CUSTOMER+"";
                            String userTypeVendor = Constants.USER_TYPE_VENDOR+"";
                            String userTypeSalesPerson = Constants.USER_TYPE_SALES_PERSON+"";
                        %>
                        <logic:equal name="ExternalUserSetupForm"  property="userAction" value="view">
                        <nested:select property="userType"  styleClass='txfield'  disabled="true">
                            <html:option value="<%=userTypeCustomer%>">Customer</html:option>
                            <html:option value="<%=userTypeVendor%>">Vendor</html:option>
                            <html:option value="<%=userTypeSalesPerson%>">Sales Person</html:option>
                        </nested:select>
                        </logic:equal>
                        <logic:notEqual name="ExternalUserSetupForm"  property="userAction" value="view">
                        <nested:select property="userType"  styleClass='txfield' onchange="showHideVendor()">
                            <html:option value="<%=userTypeCustomer%>">Customer</html:option>
                            <html:option value="<%=userTypeVendor%>">Vendor</html:option>
                            <html:option value="<%=userTypeSalesPerson%>">Sales Person</html:option>
                        </nested:select>
                        </logic:notEqual>

                    </td>
                </tr>
                <tr id="vendorTR" style="display:none;">
                    <td width="10%"><font class="NArialL">Vendor:</font><font color="RED" size="1"><B> *</B></font></td>
                    <td colspan="3">

                        <logic:equal name="ExternalUserSetupForm"  property="userAction" value="view">
                        <nested:select property="vendorId"  styleClass='txfield'  disabled="true">
                            <option value="-1">-- Select Vendor --</option>
                            <html:options collection="vendorList" property="value" labelProperty="label" />
                        </nested:select>
                        </logic:equal>
                        <logic:notEqual name="ExternalUserSetupForm"  property="userAction" value="view">
                        <nested:select property="vendorId"  styleClass='txfield'>
                            <option value="-1">-- Select Vendor --</option>
                            <html:options collection="vendorList" property="value" labelProperty="label" />
                        </nested:select>
                        </logic:notEqual>

                    </td>
                </tr>
                <tr id="customerTR" style="display:none;">
                    <td width="10%"><font class="NArialL">Customer:</font><font color="RED" size="1"><B> *</B></font></td>
                    <td colspan="3">

                        <logic:equal name="ExternalUserSetupForm"  property="userAction" value="view">
                        <nested:select property="customerId"  styleClass='txfield'  disabled="true">
                            <option value="-1">-- Select Customer --</option>
                            <html:options collection="customerList" property="value" labelProperty="label" />
                        </nested:select>
                        </logic:equal>
                        <logic:notEqual name="ExternalUserSetupForm"  property="userAction" value="view">
                        <nested:select property="customerId"  styleClass='txfield'>
                            <option value="-1">-- Select Customer --</option>
                            <html:options collection="customerList" property="value" labelProperty="label" />
                        </nested:select>
                        </logic:notEqual>

                    </td>
                </tr>
                <tr id="spersonTR" style="display:none;">
                    <td width="10%"><font class="NArialL">Sales Person:</font><font color="RED" size="1"><B> *</B></font></td>
                    <td colspan="3">

                        <logic:equal name="ExternalUserSetupForm"  property="userAction" value="view">
                        <nested:select property="salesPersonId"  styleClass='txfield'  disabled="true">
                            <option value="-1">--Select Sales Person--</option>
                            <html:options collection="salesPersonList" property="value" labelProperty="label" />
                        </nested:select>
                        </logic:equal>
                        <logic:notEqual name="ExternalUserSetupForm"  property="userAction" value="view">
                        <nested:select property="salesPersonId"  styleClass='txfield'>
                            <option value="-1">--Select Sales Person--</option>
                            <html:options collection="salesPersonList" property="value" labelProperty="label" />
                        </nested:select>
                        </logic:notEqual>

                    </td>
                </tr>
                <logic:notEqual name="ExternalUserSetupForm" property="userAction" value="view">
                <tr>
                    <td width="10%"><font class="NArialL">Password:</font><font color="RED" size="1"><B> *</B></font></td>
                    <td>
                        <nested:password property='password' size="25" maxlength='25' styleClass='txfield'/>
                    </td>
                    <td width="17%"><font class="NArialL">Confirm Password:</font><font color="RED" size="1"><B> *</B></font></td>
                    <td width="20%">
                        <html:password property="reEnterPassword" size="25" maxlength='25' styleClass="txfield"/>
                    </td>
                    <td width="10%">&nbsp</td>
                </tr>
                </logic:notEqual>
                <tr>
                    <td width="10%"><font class="NArialL">First Name:</font><font color="RED" size="1"><B> *</B></font></td>
                    <td width="20%">
                        <logic:equal name="ExternalUserSetupForm"  property="userAction" value="view">
                            <nested:text property="firstName" size="25" maxlength='25' styleClass='txfield' disabled="true"/>
                        </logic:equal>
                        <logic:notEqual name="ExternalUserSetupForm" property="userAction" value="view">
                            <nested:text property="firstName" size="25" maxlength='25' styleClass='txfield'/>
                        </logic:notEqual>

                    </td>
                    <td width="15%"><font class="NArialL">Last Name:</font></td>
                    <td width="20%">
                        <logic:equal name="ExternalUserSetupForm"  property="userAction" value="view">
                            <nested:text property="lastName" size="25" maxlength='25' styleClass='txfield' disabled="true"/>
                        </logic:equal>
                        <logic:notEqual name="ExternalUserSetupForm" property="userAction" value="view">
                            <nested:text property="lastName" size="25" maxlength='25' styleClass='txfield'/>
                        </logic:notEqual>
                    </td>
                    <td width="10%">&nbsp</td>
                </tr>
                <tr>
                    <td width="10%"><font class="NArialL">Phone Number:</font></td>
                    <td width="20%">
                        <logic:equal name="ExternalUserSetupForm"  property="userAction" value="view">
                            <nested:text property="phoneNumber" size="25" maxlength='50' styleClass='txfield' disabled="true" onkeypress='validatePhoneNumber(this)'/>
                        </logic:equal>
                        <logic:notEqual name="ExternalUserSetupForm" property="userAction" value="view">
                            <nested:text property="phoneNumber" size="25" maxlength='50' styleClass='txfield' onkeypress='validatePhoneNumber(this)'/>
                        </logic:notEqual>

                    </td>
                    <td width="15%"><font class="NArialL">Fax Number:</font></td>
                    <td width="20%">
                        <logic:equal name="ExternalUserSetupForm"  property="userAction" value="view">
                            <nested:text property="faxNumber" size="25" maxlength='50' styleClass='txfield' disabled="true" onkeypress='validatePhoneNumber(this)'/>
                        </logic:equal>
                        <logic:notEqual name="ExternalUserSetupForm" property="userAction" value="view">
                            <nested:text property="faxNumber" size="25" maxlength='50' styleClass='txfield' onkeypress='validatePhoneNumber(this)'/>
                        </logic:notEqual>
                    </td>
                    <td width="10%">&nbsp</td>
                </tr>
                <tr>
                    <td width="15%"><font class="NArialL">Email:</font><font color="RED" size="1"><B> *</B></font></td>
                    <td width="20%">
                        <logic:equal name="ExternalUserSetupForm"  property="userAction" value="view">
                            <nested:text property="email" size="25" maxlength="40" styleClass='txfield' disabled="true"/>
                        </logic:equal>
                        <logic:notEqual name="ExternalUserSetupForm" property="userAction" value="view">
                            <nested:text property="email" size="25" maxlength="40" styleClass='txfield' />
                        </logic:notEqual>

                    </td>
                    <td width="15%"><font class="NArialL">Expires On:</font></td>
                    <td width="20%">
                        <logic:equal name="ExternalUserSetupForm"  property="userAction" value="view">
                            <nested:text property="expiresOn" size="11" maxlength='10' styleClass='txfield' disabled="true"/>
                        </logic:equal>
                        <logic:notEqual name="ExternalUserSetupForm" property="userAction" value="view">
                            <nested:text property="expiresOn" size="11" maxlength='10' styleClass='txfield'/>
                        </logic:notEqual>
                        &nbsp;
                        <logic:notEqual name="ExternalUserSetupForm" property="userAction" value="view">
                            <a href="javascript:openCalendar(document.ExternalUserSetupForm[ 'externalUser.expiresOn' ])"><img onMouseOver="window.status='Click here to select date';return true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
                        </logic:notEqual>
                    </td>
                    <td width="10%">&nbsp</td>
                </tr>
                <tr>
                    <td colspan= 2 ><nested:checkbox  name="ExternalUserSetupForm" property="quoteAckMail"  value='on' /> <FONT class='NArialL'>Receive Quote Acknowledge Mails </FONT></td>
                    <%--<td width="20%">&nbsp;&nbsp;&nbsp;&nbsp;</td>--%>
                    <td width="15%">&nbsp;&nbsp;&nbsp;&nbsp;</td>
                    <td width="20%">&nbsp;&nbsp;&nbsp;&nbsp;</td>
                    <td width="10%">&nbsp;&nbsp;&nbsp;&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="4">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="4">&nbsp;</td>
                </tr>
                <!-- Begining of Displaying functionalities and permissions-->
                <% int j = 0; %>
                <tr>
                    <td colspan="4">
                        <table border="1" width="100%" bordercolor="#FFFFFF">
                            <tr>
                                <td width="33%" align="center" bgcolor="#993333">
                                    <p align="center"><font class="NArialL"><font color="#FFFFFF">Functionality</font></p>
                                </td>
                                <td width="66%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Actions</font></td>
	                        </tr>
                            <nested:iterate property="functionAccessList" name="functionAccess" type="com.scalar.chiptrack.users.FunctionAccess" >
                                <tr>
                                    <td width="33%" align="center" <%if (j%2 == 0) out.print ("bgcolor='#DEE1E2'");%>><font class="NArialL"><nested:write property="functionName" /></font></td>
                                    <td width="66%" align="left" <%if (j%2 == 0) out.print ("bgcolor='#DEE1E2'");%>><font class="NArialL">
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <logic:notEqual name="ExternalUserSetupForm"  property="userAction" value="view">
                                            <nested:equal property="showView"  value="true">
                                                <nested:checkbox property="view"/> View &nbsp;&nbsp;&nbsp;&nbsp;
                                            </nested:equal>
                                            <nested:equal property="showModify"  value="true">
                                                <nested:checkbox property="modify"/> Modify &nbsp;&nbsp;&nbsp;&nbsp;
                                            </nested:equal>
                                            <nested:equal property="showDelete"  value="true">
                                                <nested:checkbox property="delete"/> Delete &nbsp;&nbsp;&nbsp;&nbsp;
                                            </nested:equal>
                                        </logic:notEqual>
                                        <logic:equal name="ExternalUserSetupForm"  property="userAction" value="view">
                                            <nested:equal property="showView"  value="true">
                                                <nested:checkbox property="view" disabled="true"/> View &nbsp;&nbsp;&nbsp;&nbsp;
                                            </nested:equal>
                                            <nested:equal property="showModify"  value="true">
                                                <nested:checkbox property="modify" disabled="true"/> Modify &nbsp;&nbsp;&nbsp;&nbsp;
                                            </nested:equal>
                                            <nested:equal property="showDelete"  value="true">
                                                <nested:checkbox property="delete" disabled="true"/> Delete &nbsp;&nbsp;&nbsp;&nbsp;
                                            </nested:equal>
                                        </logic:equal>
                                    </td>
                                </tr>
                            </nested:iterate>

                        </table>
                    </td>
                </tr>
                <!-- End of Displaying functionalities and permissions-->
                <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
                <tr>
                    <td colspan=5 align=center>
                        <logic:equal name="ExternalUserSetupForm"  property="userAction" value="view">
                            <img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
                        </logic:equal>
                        <logic:notEqual name="ExternalUserSetupForm" property="userAction" value="view">
                            <logic:equal name="ExternalUserSetupForm"  property="userAction" value="modify">
                                <a href="javascript:modifyExternalUser()"><img onMouseOver="window.status='Click to Update External User Information';return true" onMouseout="window.status='';return true" title="Click here to Update External User Information" border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" width="53" height="17"></a>&nbsp;&nbsp;&nbsp;&nbsp;
                                <%--Added Reset button by varma 16 jul 2004 --%>
                                <a href="javascript:document.ExternalUserSetupForm.reset();"><img src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0' onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>&nbsp;&nbsp;&nbsp;&nbsp;
                            </logic:equal>
                            <logic:notEqual name="ExternalUserSetupForm"  property="userAction" value="modify">
                                <a href="javascript:saveExternalUser()"><img onMouseOver="window.status='Click to Save External User Information';return true" onMouseout="window.status='';return true" title="Click here to Save External User Information" border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" width="53" height="17"></a>&nbsp;&nbsp;&nbsp;&nbsp;
                                <a href="javascript:document.ExternalUserSetupForm.reset();"><img src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0' onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>&nbsp;&nbsp;&nbsp;&nbsp;
                            </logic:notEqual>
                        </logic:notEqual>
                        <a href="<%=chipTracContext%>/externalUserSetup.do?action=search"><img onMouseOver="window.status='Click to Cancel and go back';return true"  title ="Click here to Cancel and go Back"border="0" src="<%=chipTracContext%>/jsp/includes/images/back.gif" width="39" height="17"></a>
                    </td>
                </tr>
                <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=40></td></tr>
            </table>
        <BR><BR><BR></TD>
        <TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
    </TR>
</TABLE>
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</nested:nest>
</html:form>
</body>
</html:html>

